<%@ page language="java" import="java.util.*" pageEncoding="UTF-8" contentType="text/html; charset=UTF-8"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <title>代理人管理平台</title>
	<%@ include file="/pages/common/common.jsp" %>	
	
	<script type="text/javascript">
		
		jQuery.ajaxSetup({cache:false});//ajax不缓存
		jQuery(function($){
			//设置菜单鼠标变色效果
			$(".menuul li").mouseover(function(){
				$(this).css("background-color","#D0E5F5");
			});
			$(".menuul li").mouseout(function(){
				$(this).css("background-color","#FFF");
			});
		});
		
		/** 设置菜单 */
		function setmain(menuName,menuUrl){
			if($("#tabRegion").tabs('exists',menuName)){
				$('#tabRegion').tabs('select',menuName);
			}
			else{
				var content = '<iframe scrolling="auto" frameborder="0" src="'+ menuUrl +'" style="width:100%;height:100%;"></frame>';
				$('#tabRegion').tabs('add',{
					title: menuName,
					content: content,
					closable: true
				});
			}		
		}
		
		/** 刷新当前选项卡 */
		function freshTab(){
			var tabRegion=$("#tabRegion");
			var tab = tabRegion.tabs('getSelected');
			tabRegion.tabs('update',{
				tab:tab,
				options:{}
			});
		}
		
		/** 刷新系统缓存 */
		function freshCache(){
    		$.post('${ctx}/admin/cache/refresh.adm',function(data){
    			if(data.success){
    				$.messager.show({
						title:'提示',
						msg:'刷新系统缓存成功！',
						timeout:2500,
						showType:'slide'
					});

    			}else{
    				$.messager.alert('提示',data.msg,'warning');
    			}
    		});
    	}
		
		/** 修改密码页面 */
    function modifyPwd(){
		$("#MyPopWindow").window({
  			title:'修改密码',
  			href:'${ctx}/pages/modifyPwd.jsp',
  			width:450,
  			height:200,
  			onLoad: function(){
  				$('#queryForm').form('clear');
  			}
  		});
	}
	
	/** 修改密码操作 */
	function modify(){
		var r = $('#personForm').form('validate');
		if(!r) {
			return false;
		}
		var new1 = $('#newPwd1').val();
		var new2 = $('#newPwd2').val();
		if(new1!=new2){
			$.messager.alert('提示','输入的新密码不一致','warning');	
			return;
		}
		
		var url="${ctx}/person/modifyPwd.adm";
		$.post(url,$("#personForm").serializeArray(),function(data){
			//alert(data.msg);
			if(data.success){//操作成功
				$.messager.alert('提示','操作成功','info');
				//$('#gridTable').datagrid('reload');//刷新数据
				$('#MyPopWindow').window('close');//关闭窗口
			}else{
				$.messager.alert('提示',data.msg,'warning');	
			}
		});
	}
	</script>	
	<style type="text/css">
		.menuul{
			list-style-type: none;
			margin:0px;
			padding: 0px;
		}
		
		.menuul li{
			height: 23px;
			line-height: 23px;
			cursor: pointer;
			display: block;
			padding-left: 13px;
			background-image: url("../img/back/bullet_blue.png");
			background-repeat: no-repeat;
			background-position: -2px center;
		}
		
	</style>
  </head>
  <!-- easyui-layout 可分上下左右中五部分，中间的是必须的，支持href，这样就可以不用iframe了 -->
  <body class="easyui-layout" id="mainBody" debug="true">
		<!-- 左-->
		<div region="west" class="menudiv" split="true" title="系统菜单(MENU)" icon="icon-redo" style="width:200px;overflow:hidden;">
			<c:if test="${admin ne null}">
			<div id="menuDiv" class="easyui-accordion" fit="true" border="false" animate="false">
				<div title="信息查看" style="overflow:hidden;">
					<ul class="menuul">	
						<li onclick="setmain('查看产品列表','${ctx}/pages/agentmanage/product_list.jsp')" >产品列表</li>
						<li onclick="setmain('查看加密狗列表','${ctx}/pages/agentmanage/dog_list.jsp')" >加密狗列表</li>
					</ul>					
				</div>
				<div title="个人信息" style="overflow:hidden;">
					<ul class="menuul">	
						<li onclick="setmain('个人信息修改','${ctx}/agentManage/queryAgent.action')" >个人信息修改</li>
						<li onclick="setmain('密码修改','${ctx}/pages/agentmanage/agent_pwd.jsp')" >密码修改</li>
					</ul>					
				</div>
			</div>
			</c:if>
		</div>
		
		<!-- 中 -->
		<div region="center" class="maindiv" icon="icon-person" title="当前用户:${admin.name}(${admin.agentsn})&nbsp;[<a href='${ctx}/login/logout.action'>退出</a>]" style="overflow-x:hidden;">
			<div id="tabRegion" class="easyui-tabs" fit="true" border="false" tools="#tab-tools">
				<div title="首页" style="padding: 20px; overflow: hidden;" href="${ctx }/pages/welcome.html">
					<center/>
					<font size="5">欢迎来到升级管理系统</font>
					<center/>
				</div>
			</div>
		</div>
		<div id="tab-tools">
			<a href="#" class="easyui-linkbutton" plain="true" title="刷新当前窗口" iconCls="icon-reload" onclick="freshTab();">刷新窗口</a>|
			<!-- 
			<a href="#" class="easyui-linkbutton" plain="true" title="修改密码" iconCls="icon-edit" onclick="modifyPwd();">修改密码</a>
			 -->
		</div>
		<div id="MyPopWindow" modal="true" shadow="false" minimizable="false" cache="false" maximizable="false" collapsible="false" resizable="false" style="margin: 0px;padding: 0px;overflow: auto;"></div>
  </body>
</html>
